package com.czl.module_storehouse.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.czl.base.data.bean.tengyun.RecordRemandBean;
import com.czl.module_storehouse.R;

import java.util.List;

/**
 * @author xubin
 */
public class DamageRecordAdapter extends BaseQuickAdapter<RecordRemandBean, BaseViewHolder> {

    public DamageRecordAdapter(int layoutResId, @Nullable List<RecordRemandBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, RecordRemandBean item) {
        helper.setText(R.id.tv_title, item.getSortName())
                .setText(R.id.tv_model, "型号：" + item.getSortModelNotNull())
                .setText(R.id.tv_regis_date, "登记：" + item.getDateStr8NotNull())
                .setText(R.id.tv_damage_num, "坏了：" + (item.getDamageNumInt() - item.getLossesNumInt()))
                .setText(R.id.tv_loss_num, "丢失：" + item.getLossesNumInt())
                .setText(R.id.tv_record, item.getRecordType() + item.getRecordCodeNotNull())
                .setText(R.id.tv_record_user, item.getRemandUser())
                .setText(R.id.tv_explanation, "损坏说明：" + item.getDamageCommentNotNull())
                .setVisible(R.id.iv_next, item.getProductListSize() > 0)
                .itemView.setEnabled(item.getProductListSize() > 0);
    }
}
